import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: '/weather'
    },
    {
      path: '/weather',
      name:'home',
      component: HomeView
    },
    {
      path:'/weather/:adcode',
      name:'city',
      component: () => import('../views/CityView.vue')
    },
    {
      path:'/:pathMatch(.*)*',
      name:'404',
      component: () => import('../views/NotFoundView.vue')
    }
  ]
})

export default router
